From cef39afbe97a149e1b212b7ddb600352b7ef826a Mon Sep 17 00:00:00 2001 From: "atse@norwich.uk.xensource.com" Date: Fri, 22 Sep 2006 16:20:36 +0100 Subject: [PATCH] [XEND] Do not attempt core dump to directories. - Abort core dump if destination is a directory. - Throw appropriate XendError expection on failure. Reported by Masaki Kanno . Signed-off-by: Alastair Tse --- tools/python/xen/xend/XendDomainInfo.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 3478ef6c94..230479d7c0 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -988,14 +988,18 @@ class XendDomainInfo: this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime()) corefile = "/var/xen/dump/%s-%s.%s.core" % (this_time, self.info['name'], self.domid) + + if os.path.isdir(corefile): + raise XendError("Cannot dump core in a directory: %s" % + corefile) + xc.domain_dumpcore(self.domid, corefile) - - except: + except RuntimeError, ex: corefile_incomp = corefile+'-incomplete' os.rename(corefile, corefile_incomp) log.exception("XendDomainInfo.dumpCore failed: id = %s name = %s", self.domid, self.info['name']) - + raise XendError("Failed to dump core: %s" % str(ex)) ## public: -- 2.30.2